package com.example.hehecat.yuejian1.mvp.presenter;

import android.util.Log;

import com.example.hehecat.yuejian1.mvp.contract.ClubCollectContract;
import com.example.hehecat.yuejian1.mvp.model.ClubCollectModel;
import com.example.hehecat.yuejian1.mvp.model.bean.ClubBean;

import java.util.List;

import rx.Subscriber;

import static com.chad.library.adapter.base.listener.SimpleClickListener.TAG;

public class ClubCollectPresenter implements ClubCollectContract.Presenter {

    private ClubCollectContract.View view;
    private ClubCollectContract.Model model;

    public ClubCollectPresenter(ClubCollectContract.View view){
        this.view = view;
        model = new ClubCollectModel();
    }

    @Override
    public void updateAdapterData(int user_id) {
        model.getAllClubCollect(user_id, new Subscriber<List<ClubBean>>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(List<ClubBean> clubBeans) {
                Log.d(TAG,"onNext:" +clubBeans.get(0).getClubname());
                view.updateAdapterData(clubBeans);
            }
        });
    }
}
